i#!/bin/bash

set -ex

#define vars
SHELL_PATH=$(dirname $0)
export MTSQL_PT_FEATURE_PATH=$(cd ${SHELL_PATH}/../; pwd)
export MTSQL_PT_FEATURE_PATH_THREAD_POOL=${MTSQL_PT_FEATURE_PATH}/threadpool
export MTSQL_PT_FEATURE_PATH_THREAD_POOL_RESULT=${MTSQL_PT_FEATURE_PATH_THREAD_POOL}/result

source ${MTSQL_PT_FEATURE_PATH}/env.sh
source ${MTSQL_PT_FEATURE_PATH_THREAD_POOL}/benchmark_base_func.sh

#update result data
##oltp_read_write
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_read_write" ]]; then
  export MTSQL_PT_TEST_CASE=oltp_read_write
  python3 ${MTSQL_PT_FEATURE_PATH_THREAD_POOL_RESULT}/updateresult.py
fi

##oltp_read_only
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_read_only" ]]; then
  export MTSQL_PT_TEST_CASE=oltp_read_only
  python3 ${MTSQL_PT_FEATURE_PATH_THREAD_POOL_RESULT}/updateresult.py
fi

##oltp_update_non_index
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_update_non_index" ]]; then
  export MTSQL_PT_TEST_CASE=oltp_update_non_index
  python3 ${MTSQL_PT_FEATURE_PATH_THREAD_POOL_RESULT}/updateresult.py
fi

##oltp_point_select
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_point_select" ]]; then
  export MTSQL_PT_TEST_CASE=oltp_point_select
  python3 ${MTSQL_PT_FEATURE_PATH_THREAD_POOL_RESULT}/updateresult.py
fi

##oltp_write_only
if [[ -z ${MTSQL_PT_TEST_CASE_SPEC} || ${MTSQL_PT_TEST_CASE_SPEC} == "oltp_write_only" ]]; then
  export MTSQL_PT_TEST_CASE=oltp_write_only
  python3 ${MTSQL_PT_FEATURE_PATH_THREAD_POOL_RESULT}/updateresult.py
fi

